<?php
include ("include.php");

require("../library/php/mime.php");
require("../library/php/email.php");
//require("../library/php/general.php");


$title = $arr_viewcart_tile[$langid];
$debug = 0; // debug

$shoppingcart = new class_shoppingcart();
$langid = $HTTP_GET_VARS["langid"];
$catid = $HTTP_GET_VARS["catid"];
$subcatid = $HTTP_GET_VARS["subcatid"];
if($subcatid > 0){
	$id = $subcatid;
}else{
	$id = $catid;
}

if ($langid == ""){
	$langid = 0;
}

//Layout
$layout_file = $arr_layout[$langid][0];
include("html_layout.php");

//get data
$maso = $HTTP_POST_VARS["maso"];
$ten = $HTTP_POST_VARS["ten"];
$mausac = $HTTP_POST_VARS["mausac"];
$soluong = $HTTP_POST_VARS["soluong"];

$company_name = $HTTP_POST_VARS["company_name"];
$address = $HTTP_POST_VARS["address"];
$phone = $HTTP_POST_VARS["phone"];

$cif_hoten = $HTTP_POST_VARS["cif_hoten"];
$cif_donvi = $HTTP_POST_VARS["cif_donvi"];
$cif_diachi = $HTTP_POST_VARS["cif_diachi"];
$cif_country = $HTTP_POST_VARS["cif_country"];
$cif_dienthoai = $HTTP_POST_VARS["cif_dienthoai"];
$cif_didong = $HTTP_POST_VARS["cif_didong"];
$cif_fax = $HTTP_POST_VARS["cif_fax"];
$cif_email = $HTTP_POST_VARS["cif_email"];
$cif_noidung = $HTTP_POST_VARS["cif_noidung"];

$arr_cif = array(
		"cif_hoten"=>"$cif_hoten",
		"cif_donvi"=>"$cif_donvi",
		"cif_diachi"=>"$cif_diachi",
		"cif_country"=>"$cif_country",
		"cif_dienthoai"=>"$cif_dienthoai",
		"cif_didong"=>"$cif_didong",
		"cif_fax"=>"$cif_fax",
		"cif_email"=>"$cif_email",
		"cif_noidung"=>"$cif_noidung"
);

$order_note="I submitted the form on your website at ".$HTTP_SERVER_VARS['HTTP_REFERER'].". <br>My IP address is ".$HTTP_SERVER_VARS['REMOTE_ADDR'].".";

//echo "maso: $maso<br>";

if($HTTP_SERVER_VARS['REQUEST_METHOD'] == "POST" && $cif_email != ""){
	$str_content = $shoppingcart->sendcart();
}else{
	$str_content = "Error when submit an order";
}

$str_htm = ereg_replace("@noidung@", "$str_content", $str_htm);

//Header Loading - CSS, Meta, Javascript ...
include("html_header.php");

//Body Loading - Date-Time, ...
include("html_body.php");	

//Menu include
include("html_menu.php");

//Modules include
include("modules.php");

print $str_htm;
?>